package com.itheima.d6_thread_communuication;

/**
 * 了解线程通信
 */
public class ThreadTest1 {
    public static void main(String[] args) {
        //3个生产者线程
        //2个消费者线程
        Desk desk = new Desk();
        //创建3个生产者线程
        new Thread(()-> {
            while (true) {
                desk.put();
            }
        },"厨师1").start();

        new Thread(()-> {
            while (true) {
                desk.put();
            }
        },"厨师2").start();


        new Thread(()-> {
            while (true) {
                desk.put();
            }
        },"厨师3").start();



        new Thread(()-> {
            while (true) {
                desk.get();
            }
        },"吃货1").start();

        new Thread(()-> {
            while (true) {
                desk.get();
            }
        },"吃货2").start();
    }

}
